<?php
class sql_market_settings
{
	var $ipsclass;
	var $no_fields = array();
	
	function generate_columns()
	{
		$this->ipsclass->DB->load_cache_file(ROOT_PATH.'sources/market/sql/'.$this->ipsclass->vars['sql_driver'].'_market_queries.php','sql_market_queries');
		
		$fields = array();
		
		$this->ipsclass->DB->build_query(array('select'=>'*','from'=>'members','limit'=>array(1)));
		$mem_fields = $this->ipsclass->DB->get_result_fields($this->ipsclass->DB->exec_query());
		foreach($mem_fields as $field)
		{
			if((isset($field->numeric) && !$field->numeric) || $field->unique_key || $field->primary_key || in_array($field->name,$this->no_fields) || (is_string($field->type) && strstr($field->type,'int') === FALSE) || (is_numeric($field->type) && !in_array($field->type,array(0,3,4,5,8))))
			{
				continue;
			}
			
			if(strstr('time',$field->name) !== FALSE)
			{
				continue;
			}
			
			$fields[$field->name] = $field;
		}
		
		$return = array();
		$this->ipsclass->DB->build_query_from_cache('get_full_fields',array('table'=>'members'),'sql_market_queries');
		$mem_fields = $this->ipsclass->DB->exec_query();
		while($field = $this->ipsclass->DB->fetch_row())
		{
			if(!isset($fields[$field['Field']]) || strstr($field['Type'],'tiny') !== FALSE || strstr($field['Type'],'small') !== FALSE || strstr($field['Type'],'medium') !== FALSE)
			{
				continue;
			}
			$return[$field['Field']] = $field['Field']." [".$field['Type']."]";
		}
		
		return $return;
	}
}
?>